(function(){"use strict";BX.namespace("BX.Landing.UI.Field");var t=BX.Landing.Utils.create;var e=BX.Landing.Utils.bind;var i=BX.Landing.Utils.fireCustomEvent;var a="s";var n="ms";BX.Landing.UI.Field.Date=function(i){i.textOnly=true;BX.Landing.UI.Field.BaseField.apply(this,arguments);this.format=i.format===a||i.format===n?i.format:a;this.time=i.time===true;this.hiddenInput=t("input",{props:{type:"hidden"},value:i.content});e(this.input,"click",this.onInputClick.bind(this));this.setValue(this.formatDateToValue(i.content))};BX.Landing.UI.Field.Date.prototype={constructor:BX.Landing.UI.Field.Date,__proto__:BX.Landing.UI.Field.BaseField.prototype,onInputClick:function(){var t={node:this.input,field:this.hiddenInput,bTime:this.time,value:BX.date.format(this.getFormat(),new Date(this.formatDateToValue(this.hiddenInput.value)*1e3)),bHideTime:!this.time,callback_after:function(t){this.setValue(t.getTime()/1e3)}.bind(this)};return top.BX.calendar(t)},getFormat:function(){return BX.date.convertBitrixFormat(BX.Landing.Loc.getMessage(this.time?"FORMAT_DATETIME":"FORMAT_DATE"))},reset:function(){this.setValue("")},setValue:function(t){if(t){this.input.innerText=BX.date.format(this.getFormat(),new Date(t*1e3));this.hiddenInput.value=this.formatValue(t);this.onValueChangeHandler(this);var e=new BX.Event.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("change",e)}},formatValue:function(t){switch(this.format){case a:return t;case n:return t*1e3;default:break}},formatDateToValue:function(t){switch(this.format){case a:return t;case n:return t/1e3;default:break}},getValue:function(){return this.formatValue(this.formatDateToValue(this.hiddenInput.value))},clone:function(t){var e=Object.assign({},t||this.data,{content:(new Date).getTime()});var i=new this.constructor(e);if(this.type){i.type=this.type}return i}}})();
//# sourceMappingURL=date_field.map.js